test(core): unit-test the shared Unicode sanitizer - #3692
Open
rekcilyssup wants to merge 1 commit into
Open
Conversation
Cover each pipeline stage (NFC, control/bidi replacement, zero-width removal, whitespace collapse) plus surrogate-safe code-point capping, silent caps, and inputs that sanitize to empty. The module is the single source of truth shared by session names and foreign-session names and had no direct tests. Generated-By: opencode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/core/src/text-sanitize.tsis the single source of truth (#1404) for the Unicode sanitize pipeline shared by session names (session-name.ts) and foreign-session names (foreign-session.ts) — explicitly documented as security-adjacent (bidi-spoofing defense) shared infrastructure — but it had no direct unit tests; only callers exercised it transitively.This adds direct coverage of each pipeline stage and edge:
Character classes are asserted via
\uXXXXescapes in both source and test, per the note intext-sanitize.tsabout keeping files text-safe for git.No production code is touched.
Verification
node --test packages/core/dist/__tests__/text-sanitize.test.js).@maka/coresuite: 660 tests, 660 pass.npx biome check packages/core/srcclean; ASF header check passes.AI use
Select exactly one:
Tool(s) and scope: opencode — identified the coverage gap, wrote the tests against the documented pipeline, hand-checked expectations against the implementation. Commit carries the
Generated-By: opencodetrailer.Checklist
Does this PR entail a change in behavior?